package cn.aifeix.feign;

import cn.aifeix.domain.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(name = "user-server",fallbackFactory = UserFeignClientFallbackFactory.class) // 指定被调用的服务名称
public interface UserFeignClient {

    /**
     * 调用user服务接口，默认底层会帮助我们创建动态代理实现类，会使用RestTemplate进行调用
     * @param id
     * @return
     */
    @GetMapping("/user/{id}")
    User getUserById(@PathVariable("id") Long id);
}
